package clock.hand;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Calendar;

public class SecondHand extends ClockHand {

	private int handX, handY;
	
	public SecondHand(int axisX, int axisY) {
		super(axisX, axisY);
	}

	@Override
	public void update() {
		this.tick = Calendar.getInstance().get(Calendar.SECOND);
		
		this.handX = (int) (65 * Math.cos(Math.toRadians(this.tick*6-90)) + this.axisX);
		this.handY = (int) (65 * Math.sin(Math.toRadians(this.tick*6-90)) + this.axisY);
	}

	@Override
	public void draw(Graphics2D g) {
		this.update();
		
		g.setColor(Color.BLACK);
		g.drawLine(this.axisX, this.axisY, this.handX, this.handY);
	
	}

}
